package bishi.saikr;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2022/03/19 19:29
 */
public class _01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        int[][] dp = new int[n][m];//第i个，是第j次攻击的最优情况
        for (int i = 0; i < n; i++) {
            for (int j = i / k; j < m; j++) {
                if (i < j) {
                    break;
                }
                int max = 0;
                if (j == 0) {
                    dp[i][j] = nums[i];
                } else {
                    for (int l = 0; l < k && i - l > 0; l++) {
                        max = Math.max(max, dp[i - l - 1][j - 1] + nums[i]);
                    }
                    dp[i][j] = max;
                }
            }
            System.out.println(Arrays.toString(dp[i]));
        }
        System.out.println(dp[n - 1][m - 1]);
    }
}
//5,2,7,20,9